window.onload = function (){
    var errorInfo = getQuery("errorInfo");
    if(errorInfo != null && errorInfo == 'noCustom'){
        $("errorDiv").innerHTML = "请以顾客身份登陆";
    }
}

function login(){
    axios.get("/user/login",{
        params:{
            userName:$("userName").value,
            pwd:$("pwd").value
        }
    }).then(resp =>{
        var info = resp.data;
        if(info != ""){
            if(info.grade == "顾客"){
                location.href = "/index.html";
            }
            else if(info.grade == "管理员"){
                location.href = "/manager/showOrder.html";
            }
            else{
                location.href = "/send/send.html";
            }
        }
        else{
            $("errorDiv").innerHTML = "登陆失败";
        }
    })
}